package net.dp.observer.tmp;

import net.dp.observer.CurrentConditionsDisplay;
import net.dp.observer.ForecastDisplay;
import net.dp.observer.StatisticsDisplay;

/**
 * Created by catold on 16/4/5.
 */
public class WeatherData {
    private float temperature;
    private float humidity;
    private float pressure;

    CurrentConditionsDisplay currentConditionsDisplay;
    StatisticsDisplay statisticsDisplay;
    ForecastDisplay forecastDisplay;

    public void changed(){
        float temperature = getTemperature();
        float humidity = getHumidity();
        float pressure = getPressure();

        // WARNING 针对实现编程
        currentConditionsDisplay.update(temperature, humidity, pressure);
        statisticsDisplay.update(temperature, humidity, pressure);
        forecastDisplay.update(temperature, humidity, pressure);
    }

    public void setTemperature(float temperature) {
        this.temperature = temperature;
    }

    public void setHumidity(float humidity) {
        this.humidity = humidity;
    }

    public void setPressure(float pressure) {
        this.pressure = pressure;
    }

    public float getTemperature() {
        return temperature;
    }

    public float getHumidity() {
        return humidity;
    }

    public float getPressure() {
        return pressure;
    }
}
